package com.wolfking.mask;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;

public class GsonMaskMobile extends TypeAdapter<String> {

    @Override
    public void write(JsonWriter out, String value) throws IOException {
        out.jsonValue(SensitiveInfoUtils.mobilePhone(value));
    }

    @Override
    public String read(JsonReader in) throws IOException {
        return in.nextString();
    }
}
